<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitepagereview
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: Global.php 2011-05-05 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
class Sitepagereview_Form_Admin_Settings_Global extends Engine_Form {
	
	public function init() {
		$this->setTitle ( 'Global Settings' )->setDescription ( 'These settings affect all members in your community.' );
		
		$this->addElement ( 'Text', 'sitepagereview_lsettings', array ('label' => 'Enter License key', 'description' => "Please enter your license key that was provided to you when you purchased this plugin. If you do not know your license key, please contact the Support Team of SocialEngineAddOns from the Support section of your Account Area.(Key Format: XXXXXX-XXXXXX-XXXXXX )", 'value' => Engine_Api::_ ()->getApi ( 'settings', 'core' )->getSetting ( 'sitepagereview.lsettings' ) ) );
		
		$global_settings_file = APPLICATION_PATH . '/application/settings/general.php';
		if (file_exists ( $global_settings_file )) {
			$generalConfig = include $global_settings_file;
		} else {
			$generalConfig = array ();
		}
		if ((! empty ( $generalConfig ['environment_mode'] )) && ($generalConfig ['environment_mode'] != 'development')) {
			$this->addElement ( 'Checkbox', 'environment_mode', array ('label' => 'Your community is currently in "Production Mode". We recommend that you momentarily switch your site to "Development Mode" so that the CSS of this plugin renders fine as soon as the plugin is installed. After completely installing this plugin and visiting few pages of your site, you may again change the System Mode back to "Production Mode" from the Admin Panel Home. (In Production Mode, caching prevents CSS of new plugins to be rendered immediately after installation.)', 'description' => 'System Mode', 'value' => 1 ) );
		} else {
			$this->addElement ( 'Hidden', 'environment_mode', array ('order' => 990, 'value' => 0 ) );
		}
		
		$this->addElement ( 'Button', 'submit_lsetting', array ('label' => 'Activate Your Plugin Now', 'type' => 'submit', 'ignore' => true ) );
		
		$this->addElement ( 'Radio', 'sitepagereview_proscons', array ('label' => 'Pros and Cons in Reviews', 'description' => 'Do you want Pros and Cons fields in Reviews? (If enabled, reviewers will be able to enter Pros and Cons for the Pages that they review, and the same will be shown in their reviews.)', 'multiOptions' => array (1 => 'Yes', 0 => 'No' ), 'value' => Engine_Api::_ ()->getApi ( 'settings', 'core' )->getSetting ( 'sitepagereview.proscons', 1 ) ) );
		
		$this->addElement ( 'Text', 'sitepagereview_limit_proscons', array ('label' => 'Pros and Cons Character Limit', 'required' => true, 'allowEmpty' => false, 'description' => 'What character limit should be applied to the Pros and Cons fields? (Enter 0 for no character limitation.)', 'value' => Engine_Api::_ ()->getApi ( 'settings', 'core' )->getSetting ( 'sitepagereview.limit.proscons', 75 ) ) );
		
		$this->addElement ( 'Radio', 'sitepagereview_recommend', array ('label' => 'Recommended in Reviews', 'description' => 'Do you want Recommended field in Reviews? (If enabled, reviewers will be able to select if they would recommend that Page to a friend, and the same will be shown in their review.)', 'multiOptions' => array (1 => 'Yes', 0 => 'No' ), 'value' => Engine_Api::_ ()->getApi ( 'settings', 'core' )->getSetting ( 'sitepagereview.recommend', 1 ) ) );
		
		$this->addElement ( 'Text', 'sitepagereview_truncation_limit', array ('label' => 'Title Truncation Limit', 'description' => 'What maximum limit should be applied to the number of characters in the titles of items in the widgets? (Enter a number between 1 and 999. Titles having more characters than this limit will be truncated. Complete titles will be shown on mouseover.)', 'required' => true, 'maxLength' => 3, 'value' => Engine_Api::_ ()->getApi ( 'settings', 'core' )->getSetting ( 'sitepagereview.truncation.limit', 13 ), 'validators' => array (array ('Int', true ), array ('GreaterThan', true, array (0 ) ) ) ) );
		
		$this->addElement ( 'Text', 'sitepagereview_manifestUrl', array ('label' => 'Page Reviews URL alternate text for "pagereviews"', 'allowEmpty' => false, 'required' => true, 'description' => 'Please enter the text below which you want to display in place of "pagereviews" in the URLs of this plugin.', 'value' => Engine_Api::_ ()->getApi ( 'settings', 'core' )->getSetting ( 'sitepagereview.manifestUrl', "pagereviews" ) ) );
		
		$this->addElement ( 'Button', 'submit', array ('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true ) );
	}

}
?>